<include file="common/header" />
<script type="text/javascript" src="/javascript/home/juicer-min.js"></script>

<div class="main-container">
    <div class="container" id="wrap-detail">
        <div class="row mb10">
            <div class="col-sm-8">
                <h1 class="detail-title mb15">{$deal_info.name}</h1>

                <div>
                    <span class="mr10">发起人：{$deal_info.user_name}</span>
                    <span>{$deal_info.province}{$deal_info.city}</span>
                </div>
            </div>
            <div class="col-sm-4 text-right">
                <if condition="($user.id neq $deal_info['user_id'])">
                    <if condition="($deal_info.end_time lt $now) AND ($deal_info.end_time neq 0)">
                        <button class="ui-btn ui-btn-blue btn-support mr10 ui-btn-disabled">
                            <i class="glyphicon glyphicon-star"></i><span>支持</span>
                        </button>
                        <else/>
                        <button class="ui-btn ui-btn-blue btn-support mr10" data-toggle="modal" data-target=".modal-support">
                            <i class="glyphicon glyphicon-star"></i><span>支持</span>
                        </button>
                    </if>
                <button class="ui-btn <if condition="($fav_status eq 1)">ui-btn-disabled<else />ui-btn-red</if> btn-like" id="add-like" data-id="{$deal_info.id}"><i class="glyphicon glyphicon-heart"></i><span class="like-text"><if condition="($fav_status eq 1)">不再喜欢<else />喜欢</if></span></button>
                </if>
            </div>
            <div class="modal modal-support" tabindex="-1" role="dialog"  aria-hidden="true">
                <div class="modal-dialog dialog-support">
                    <div class="modal-content">
                        <button class="ui-btn ui-btn-blue btn-add-close" data-dismiss="modal"><i class="glyphicon glyphicon-remove"></i></button>
                        <div class="modal-support-head">
                            选择你的支持项目
                        </div>
                        <div class="modal-support-content">
                            <volist name="deal_item_list" id="vo" key="k">
                                <div class="support-item <if condition="($support_full gt 1)">support-full</if>">
                                <div class="clearfix mb15">
                                    <span class="pull-left support-money">￥{$vo.price_format}</span>
                                    <if condition="($deal_info.end_time lt $now) AND ($deal_info.end_time neq 0)">
                                        <a class="ui-btn btn-support ui-btn-blue pull-right mt10 ui-btn-disabled">项目过期</a>
                                        <else/>
                                        <a <if condition="($vo.support_full eq 0)">href="/cart.html?id={$vo.id}"</if> class="ui-btn btn-support ui-btn-blue pull-right mt10 <if condition="($vo.support_full eq 1)">ui-btn-disabled</if>"><if condition="($vo.support_full eq 1)">限额已满<else />支持</if></a>
                                    </if>
                                </div>
                                <h1>{$vo.title}</h1>
                                <p class="mb20">{$vo.description|nl2br}</p>
                                <p><if condition="($vo.limit_user eq 0)">不限购买人数<else />限额<span class="fc-red">{$vo.limit_user}</span>位，剩余<span class="fc-red">{$vo.limit_remain}</span>位</if></p>
                                <!--<div class="img"><img src="/images/home/upload/touxiang.jpg"></div>-->
                                <p class="fc9 mt10 mb5">预计回报发放时间:项目成功结束后{$vo.repaid_day}天</p>
                                <p class="fc9"><if condition="($vo.is_delivery eq 1)"><if condition="($vo.delivery_fee gt 0)">¥{$vo.delivery_fee|round=2}<else />全国包邮</if><else />不需要配送</if></p>
                        </div>
                        </volist>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row hidden-lg">
        <div class="col-xs-12" style="position: relative;height: 22px;">
            <!-- JiaThis Button BEGIN -->
            <div style="position: absolute;right: 0;">
                <div class="jiathis_style">
                    <a class="jiathis_button_qzone"></a>
                    <a class="jiathis_button_tsina"></a>
                    <a class="jiathis_button_weixin"></a>
                    <a class="jiathis_button_renren"></a>
                    <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
                    <a class="jiathis_counter_style"></a>
                </div>
                <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
            </div>
            <!-- JiaThis Button END -->
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8">
            <div class="detail-wrap">
                <div class="detail-sum clearfix p10 mb20">
                    <div class="sum-title pull-left mr10">
                        <p>项目简介</p>
                    </div>
                    <div class="sum-text">
                        {$deal_info.brief}
                    </div>
                </div>
                <div class="detail-content">
                    <div class="detail-index mb20">
                        <ul class="clearfix wrap-detail-tabs">
                            <li><a href="/deal/show/?id={$deal_info.id}">项目主页</a><i class="glyphicon glyphicon-arrow-down detail-tabs-icon"></i></li>
                            <li><a href="/deal/status/?id={$deal_info.id}">项目进展 </a><i class="glyphicon glyphicon-arrow-down detail-tabs-icon"></i></li>
                            <li class="current"><a href="/deal/comment/?id={$deal_info.id}">咨询评论</a><i class="glyphicon glyphicon-arrow-down detail-tabs-icon"></i></li>
                            <li><a href="/deal/intro/?id={$deal_info.id}">自我介绍 </a><i class="glyphicon glyphicon-arrow-down detail-tabs-icon"></i></li>
                        </ul>
                        <div class="wrap-share visible-lg">
                            <!-- JiaThis Button BEGIN -->
                            <div class="jiathis_style">
                                <a class="jiathis_button_qzone"></a>
                                <a class="jiathis_button_tsina"></a>
                                <a class="jiathis_button_weixin"></a>
                                <a class="jiathis_button_renren"></a>
                                <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
                                <a class="jiathis_counter_style"></a>
                            </div>
                            <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
                            <!-- JiaThis Button END -->
                        </div>

                        <div class="detail-textarea">
                            <div class="box-textarea">
                                <textarea placeholder="请在此输入想要评论的问题" class="content0" rows="10"></textarea>
                            </div>
                        </div>
                        <div class="row plr15 mb20">
                            <button class="ui-btn ui-btn-blue col-xs-3 btn-answer col-xs-offset-9 send-discuss" data-id="0" deal-id="{$deal_info.id}">发表评论<i
                                    class="glyphicon glyphicon-chevron-right ml10 f16"></i></button>
                        </div>

                        <div id="detail-tabs-content">
                                <div style="width:100%;height: 1px;background-color: #DDD;"></div>
                            <!-- Tab panes -->
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active">
                                    <ul class="appraise-list">
                                        <volist name="list" id="vo">
                                        <li class="row">
                                            <div class="date">
                                                <span class="day">{$vo.create_time|date="d",###}</span>
                                                <span class="month">{$vo.create_time|date="m",###}月</span>
                                            </div>

                                            <div class="col-xs-9 col-xs-offset-1">
                                                <div class="discuss-main">
                                                    <div class="discuss-text">
                                                        <span class="dis-name">{$vo.user_name}:</span> {$vo.content}
                                                    </div>
                                                    <if condition="($project_master eq 1)">
                                                    <div class="appraise-count ui-btn ui-btn-blue" data-toggle="collapse" data-target="#discuss-item{$vo.id}" aria-expanded="false" aria-controls="discuss-item{$vo.id}"  data-id="{$vo.id}" deal-id="{$deal_info.id}">
                                                        <if condition="($vo.reply_status eq 1)">
                                                            已回复
                                                            <else />
                                                            未回复
                                                        </if>
                                                    </div>
                                                    </if>
                                                </div>

                                                <div class="collapse mt15" id="discuss-item{$vo.id}">
                                                    <div class="well">
                                                        <if condition="($project_master eq 1)">
                                                            <div class="dis-textarea">
                                                                <!-- 这里ajaxPOST提交评论 -->
                                                                <textarea name="content" class="setting-sum content{$vo.id}" placeholder="您的回复可更有效的帮助支持者了解您和项目信息"></textarea>
                                                                <button class="ui-btn ui-btn-blue btn-discuss send-discuss" data-id="{$vo.id}" deal-id="{$deal_info.id}">
                                                                    <if condition="($vo.reply_status eq 1)">
                                                                        修改回复
                                                                        <else />
                                                                        回复
                                                                    </if>
                                                                </button>
                                                            </div>
                                                            </if>
                                                        <if condition="($vo.reply_status eq 1)">
                                                        <ul class="dis-list dis-list{$vo.id}">
                                                            <li>
                                                            <img src="{$vo.avatar_small}" class="dis-list-photo">
                                                            <span class="dis-name">{$vo.deal_user_name}：</span><span class="dis-text" id="reply{$vo.id}">{$vo.reply_content}</span>
                                                                <span class="reply-time">回复时间：{$vo.reply_time|date="Y-m-d H:i",###}</span>
                                                            </li>
                                                        </ul>
                                                        </if>
                                                    </div>
                                                </div>
                                                <if condition="($project_master neq 1)">
                                                <div class="well">
                                                        <ul class="dis-list dis-list{$vo.id}">
                                                            <li>
                                                                <img src="{$vo.avatar_small}" class="dis-list-photo">
                                                                <span class="dis-name">{$vo.deal_user_name}：</span><span class="dis-text" id="reply{$vo.id}">{$vo.reply_content}</span>
                                                                <span class="reply-time">{$vo.reply_time|date="Y-m-d H:i",###}</span>
                                                            </li>
                                                        </ul>
                                                </div>
                                                </if>
                                            </div>
                                        </li>
                                        </volist>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <include file="right_content" />
    </div>
</div>
</div>
<!--<script id="tpl" type="text/template">-->
    <!--{@each data as vo,index}-->
    <!--<li>-->
        <!--<img src="${vo.avatar_small}" class="dis-list-photo">-->
        <!--<span class="dis-name">${vo.deal_user_name}：</span><span class="dis-text">${vo.content}</span>-->
    <!--</li>-->
    <!--{@/each}-->
<!--</script>-->
        <script>
            $(function(){
                $(".send-discuss").on('click',function(){
                    var id = $(this).attr('data-id');
                    var deal_id = $(this).attr('deal-id');
                    var content = $('.content'+id).val()
//                    editor.sync();
//                    var content = encodeURI($('#comment-textarea').val());
                    if(content.length<=0){alert("评论内容不能为空");return false;}
                    $.post('/deal/comment_do',{id:id,deal_id:deal_id,content:content},function(data){
                        alert(data.info);
                        if(data.status == 1){
                            window.location.reload();
                            $("#reply"+id).text(content);
                        }
                    },'json')
                })
            })
        </script>
<include file="common/footer" />